﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace EditTable
{
    public partial class FormDelete : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Write(Request.Params["ID"]);
        }

        protected void buttonYes_Click(object sender, EventArgs e)
        {
            try
            {
                int id = int.Parse(Request.Params["ID"]);
                NorthWindClass.DeleteCategoryByID(id);
                Response.Redirect("~/FormView.aspx");
            }
            catch (Exception)
            {
                Response.Write("Cannot delete!");
            }            
        }

        protected void buttonNo_Click(object sender, EventArgs e)
        {
            Response.Redirect("~/FormView.aspx");
        }
    }
}